% solver_preparation is a matlab function who gets

% new grid size - ni,nj,nk - from nsize vector 
% number of cells in each direction within the blocks - ncells
% (this one deserves a parenthesis because we have programmed a routine
% that allows final grids not exactly divisible from the original. With
% that the number of cells within the blocks r not constant and requires a
% special treatment that was solve using the matlab structure 'cells'.)
% and this function also takes but no less important 'the direction block
% dimensions' nDI,nDJ,nDK (the new cells 'dx') (this also gets a resave
% because if we r using the routine mentioned above the block dimensions
% also r not constant! for more information see Ramos, J.A.F 2011)

%by jose augusto f. ramos - last update date 22/08/11
%contact zeaugustofr@gmail.com

function [ni,nj,nk,cells_i,cells_j,cells_k,nDI,nDJ,nDK,np] = ...
    solver_preparation(i,j,k,DI,DJ,DK,nsize)

%new grid size (upscaling one)
ni = nsize(1);
nj = nsize(2);
nk = nsize(3);

np = ni*nj*nk; %this also gets the new number of cells

%number of cells in each direction within the blocks

%with distribuicao the upscaled grid can be not exactly divisible
%from the inicitial grid
cells_i = distribuicao(i,ni);
cells_j = distribuicao(j,nj);
cells_k = distribuicao(k,nk);

% %direction block dimensions upscaling% %
nDI = DI*cells_i;
nDJ = DJ*cells_j;
nDK = DK*cells_k;

